package ltd.sshine.networkserver.utils;


import ltd.sshine.networkcommon.pojo.Result;

public class ResultUtils {

    public static <T> Result<T> success() {
        return success(null);
    }


    public static <T> Result<T> success(T data) {
        return message("ok",200,data);
    }

    public static<T> Result<T> error(String msg){
        return message(msg,500,null);
    }
    public static<T> Result<T> error(String msg,int code){
        return message(msg,code,null);
    }
    public static<T> Result<T> error(String msg,int code,T data){
        return message(msg, code, data);
    }

    public static  <T> Result<T> message( String msg,int code,T data) {
        return new Result<T>().setMsg(msg).setCode(code).setData(data);
    }


}